<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>变量作用域</title>
    </head>
    <body>
        <script>
            console.log("------------");
            console.log("---第二题---");
            console.log("------------");

            function Person(name, age) {
                this.name = name;
                this.age = age;
            }

            function func1(person) {
                person.name = "liSi";
                person = new Person("wangWu", 20);
                person.name = "zhaoLiu";
            }
            var personObj = new Person("zhangSan", 10);
            console.log(personObj.name);
            func1(personObj);
            console.log(personObj.name);
        </script>
        <script>
            console.log("------------");
            console.log("---第一题---");
            console.log("------------");

            var num1 = 1;
            var num2 = 2;
            function func1(num, num1) {
                num = 10;
                num1 = 20;
                num2 = 30;
                console.log(num1);
                console.log(num2);
                console.log(num);
            }
            func1(num1, num2);
            console.log(num1);
            console.log(num2);
            console.log(num);
        </script>
    </body>
</html>
<script></script>
